import { createApp,onMounted } from 'vue'
import App from './App.vue'
//导入路由配置
import router from './router/'

//导入element-plus
import ElementPlus from 'element-plus'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import 'element-plus/dist/index.css'
import "./assets/css/index.css"

//导入element-plus的图标
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

//npm uninstall vuex
//npm install pinia
//npm i pinia-plugin-persist 持久化
import { createPinia } from "pinia";
import piniaPluginPersist from 'pinia-plugin-persist'

//导入自定义指令
import {permissions} from "./directives";

const store = createPinia()
store.use(piniaPluginPersist)


let app = createApp(App);

//全局注册Element图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app
  .use(router)//使用路由
  .use(ElementPlus, {
    locale: zhCn,
  })//使用ElementPlus,并使用中文语言
  .use(store) //使用pinia数据仓库
  .use(permissions) //使用自定义指令
  .mount('#app');//挂载到id=app的html元素中

